package com.whmskj.xjlhsc.mobie.empProPlan.controller;

import com.whmskj.xjlhsc.mobie.empProPlan.entity.ProPersonnelStandMachine;
import com.whmskj.xjlhsc.mobie.empProPlan.service.ProPersonnelStandMachineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;

/**
 * 人员看台（1）机台（多）表
 *
 * @author lk
 * @since 2025-07-07 11:22:42
 */
@RestController
@RequestMapping("/proPersonnelStandMachine")
public class ProPersonnelStandMachineController {

    @Autowired
    private ProPersonnelStandMachineService proPersonnelStandMachineService;

    /**
     * 分页查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findPage")
    public ResponseEntity<Page<ProPersonnelStandMachine>> findPage(@RequestBody ProPersonnelStandMachine params) {
        Page<ProPersonnelStandMachine> result = proPersonnelStandMachineService.findPage(params);
        return ResponseEntity.ok(result);
    }
    /**
     * 列表查询
     *
     * @param params
     * @return
     */
    @PostMapping("/findList")
    public ResponseEntity<List<ProPersonnelStandMachine>> findList(@RequestBody ProPersonnelStandMachine params) {
        List<ProPersonnelStandMachine> result = proPersonnelStandMachineService.findList(params);
        return ResponseEntity.ok(result);
    }

    /**
     * 查询
     *
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public ResponseEntity<ProPersonnelStandMachine> findById(@PathVariable("id") Long id) {
        ProPersonnelStandMachine proPersonnelStandMachine = proPersonnelStandMachineService.findById(id);
        return ResponseEntity.ok(proPersonnelStandMachine);
    }

    /**
     * 新增
     *
     * @param proPersonnelStandMachine
     * @return
     */
    @PostMapping
    public ResponseEntity<Boolean> insert( @RequestBody ProPersonnelStandMachine proPersonnelStandMachine) {
        boolean result = proPersonnelStandMachineService.insert(proPersonnelStandMachine);
        return ResponseEntity.ok(result);
    }

    /**
     * 修改
     *
     * @param proPersonnelStandMachine
     * @return
     */
    @PutMapping
    public ResponseEntity<Boolean> update( @RequestBody ProPersonnelStandMachine proPersonnelStandMachine) {
        boolean result = proPersonnelStandMachineService.update(proPersonnelStandMachine);
        return ResponseEntity.ok(result);
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ResponseEntity<Integer> delete(@PathVariable("id") Long id) {
        int result = proPersonnelStandMachineService.delete(id);
        return ResponseEntity.ok(result);
    }

}